package com.rh.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 容器加载时读取配置文件
 */
@Component //交由spring管理
public class ConstantVodProperties implements InitializingBean {
    //读取配置文件内容
    @Value("${aliyun.vod.file.keyid}")
    private String keyId;
    @Value("${aliyun.vod.file.keysecret}")
    private String keySecret;

    //定义公开常量
    public static String KEY_ID;
    public static String KEY_SECRET;

    @Override
    public void afterPropertiesSet() throws Exception {
    //给静态常量赋值
        KEY_ID=keyId;
        KEY_SECRET=keySecret;
    }
}
